package com.example.ivideo_2201.test

import android.os.Bundle
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import com.example.ivideo_2201.R
import com.umeng.analytics.MobclickAgent

class UmengTestActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_umeng_test)
        // 456

    }
    //手动页面采集
    override fun onResume() {
        super.onResume()
        MobclickAgent.onPageStart("UmengTestActivity")
    }

    override fun onPause() {
        super.onPause()
        MobclickAgent.onPageEnd("UmengTestActivity")
    }
    //统计账号
    fun login(view: View) {
        //当用户使用自有账号登录时，可以这样统计：
        MobclickAgent.onProfileSignIn("yaotianxue")
        MobclickAgent.userProfileMobile("13387538888")
        MobclickAgent.userProfileEMail("developer@gmail.com")
        MobclickAgent.userProfile("key111", "val111")
        MobclickAgent.userProfile("key222", 123457878L)
        MobclickAgent.userProfile("key333", 0.0234 as Double)
        //当用户使用第三方账号（如新浪微博）登录时，可以这样统计：
//        MobclickAgent.onProfileSignIn("WB","userID");
    }
    fun logout(view: View) {
        MobclickAgent.onProfileSignOff()
    }

    /**
     * 事件埋点
     */
    fun playVideo(view: View) {
        val map = mutableMapOf<String,Any>()
        map["video_id"] = 101
        map["video_name"] = "爸爸去哪儿"
        MobclickAgent.onEventObject(this,"play_video",map)
    }


}